package org.example.servlet_01.request;

import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.BufferedReader;
import java.io.IOException;

/**
 *  获取请求体数据（请求参数）
 */

@WebServlet("/RequestDemo3")
public class RequestDemo3 extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.setCharacterEncoding("UTF-8");
        //1.获取字符输入流
        BufferedReader reader = request.getReader();
        //2.获取数据
        String line = null;
        while((line = reader.readLine())!=null){
            System.out.println(line);
        }
    }
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response){

    }
}
